{template 'common/header'}

<ul class="nav nav-tabs">
	<li class="active"><a href="{php echo $this->createWebUrl('share',array('op' =>'display'))}">分享设置</a></li>
	<li{if empty($adv['id']) && $operation == 'post'} class="active" {/if}><a href="{php echo $this->createWebUrl('share',array('op' =>'post'))}">添加分享</a></li>
</ul>

{if $operation == 'display'}
<div class="main panel panel-default">
	<div class="panel-body table-responsive">
		<form action="" method="post">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th style="width:10%;">排序</th>
					<th>页面</th>
					<th>分享标题</th>
					<th>分享图标</th>
					<th>是否生效</th>
					<th style="text-align:right;width:15%;">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $adv}
				<tr>
					<td><input class="form-control" name="displayorder[{$adv['id']}]" value="{$adv['displayorder']}" type="text"></td>
					<td>{if $adv['cateid'] == 80}首页{/if}{if $adv['cateid'] == 81}文章列表页{/if}{if $adv['cateid'] == 82}美团页面{/if}{if $adv['cateid'] == 83}饿了么页面{/if}{if $adv['cateid'] == 84}电影票首页{/if}{if $adv['cateid'] == 85}积分中心首页{/if}{if $adv['cateid'] == 86}任务中心{/if}{if $adv['cateid'] == 87}个人中心{/if}{if $adv['cateid'] == 88}电影票订单{/if}{if $adv['cateid'] == 89}积分商品订单{/if}{if $adv['cateid'] == 90}美团团购首页{/if}</td>
					<td>{$adv['title']}</td>
					<td class="text-left">
						<img src="{$_W['attachurl']}{$adv['thumb']}" style="width:40px;" />
					</td>
					<td>{if $adv['is_show']==1}生效{else}不生效{/if}</td>
					<td style="text-align:right;">
					    <a href="{php echo $this->createWebUrl('share', array('op' => 'show', 'id' => $adv['id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="{if $adv['is_show'] == 1}隐藏{/if}">{if $adv['is_show'] == 1}不生效{/if}{if $adv['is_show'] == 0}生效{/if}</a>
						<a href="{php echo $this->createWebUrl('share', array('op' => 'post', 'id' => $adv['id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="修改"><i class="fa fa-edit"></i></a>
						<a href="{php echo $this->createWebUrl('share', array('op' => 'delete', 'id' => $adv['id']))}"class="btn btn-default btn-sm" onclick="return confirm('此操作不可恢复，确认删除？');return false;" data-toggle="tooltip" data-placement="top" title="删除"><i class="fa fa-times"></i></a>
					</td>
				</tr>
				{/loop}
				<tr>
					<td colspan="6">
						<input name="submit" class="btn btn-primary" value="提交" type="submit">
						<input name="token" value="{$_W['token']}" type="hidden">
					</td>
				</tr>
			</tbody>
		</table>
		</form>
	</div>
</div>
<script>
	require(['bootstrap'],function($){
		$('.btn').hover(function(){
			$(this).tooltip('show');
		},function(){
			$(this).tooltip('hide');
		});
	});
</script>
{elseif $operation == 'post'}

<div class="main">
	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" onsubmit='return formcheck()'>
		<input type="hidden" name="id" value="{$adv['id']}" />
		<div class="panel panel-default">
			<div class="panel-heading">
				分享设置
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">排序：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[displayorder]" class="form-control" value="{$adv['displayorder']}" />
						<span class="help-block">降序</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">分享页面：</label>
					<div class="col-sm-9 col-xs-12">
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="80" {if $adv['cateid'] == 80}checked="true"{/if} /> 首页</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="82" {if $adv['cateid'] == 82}checked="true"{/if} /> 美团页面</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="83" {if $adv['cateid'] == 83}checked="true"{/if} /> 饿了么页面</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="84" {if $adv['cateid'] == 84}checked="true"{/if} /> 电影票首页</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="85" {if $adv['cateid'] == 85}checked="true"{/if} /> 积分中心首页</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="86" {if $adv['cateid'] == 86}checked="true"{/if} /> 任务中心</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="87" {if $adv['cateid'] == 87}checked="true"{/if} /> 个人中心</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="88" {if $adv['cateid'] == 88}checked="true"{/if} /> 电影票订单</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="89" {if $adv['cateid'] == 89}checked="true"{/if} /> 积分商品订单</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="81" {if $adv['cateid'] == 81}checked="true"{/if} /> 文章列表</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[cateid]" value="90" {if $adv['cateid'] == 90}checked="true"{/if} /> 美团团购首页</label>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">分享标题：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id='title' name="data[title]" class="form-control" value="{$adv['title']}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">分享图标</label>
					<div class="col-sm-9">
						{php echo tpl_form_field_image('data[thumb]', $adv['thumb'], '', array('width' => 420, 'height' => 335))}
						<span class="help-block" style="color:#f00">图片尺寸：420*335</span>
					</div>
				</div>
				<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否生效：</label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline"><input type="radio" name="data[is_show]" value="1" {if $adv['is_show'] == 1}checked="true"{/if} /> 生效</label>
							&nbsp;&nbsp;&nbsp;
							<label class="radio-inline"><input type="radio" name="data[is_show]" value="0" {if $adv['is_show'] == 0}checked="true"{/if} /> 不生效</label>
						</div>
				</div>

				
			</div>
		</div>
		<div class="form-group col-sm-12">
			<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
	</form>
</div>

{/if}
{template 'common/footer'}